using System;
using UnityEngine;

[Serializable]
public class bback : MonoBehaviour
{
	public AudioClip clip;

	public string scene;

	public bback()
	{
		scene = string.Empty;
	}

	public void Update()
	{
		if (!Input.GetKeyDown(KeyCode.Escape))
		{
			return;
		}
		if (StateManager.state == State.HelpScreen)
		{
			if ((bool)GameObject.Find("Help"))
			{
				(GameObject.Find("Help").GetComponent("GUITouchScrollJS") as GUITouchScrollJS).DisableHelp(changelog: false);
				return;
			}
		}
		else if (StateManager.state == State.ChangeLog)
		{
			if ((bool)GameObject.Find("Help"))
			{
				(GameObject.Find("Help").GetComponent("GUITouchScrollJS") as GUITouchScrollJS).DisableHelp(changelog: true);
				return;
			}
		}
		else if (StateManager.state == State.Credits && (bool)GameObject.Find("Credits"))
		{
			GameObject.Find("Credits").SetActiveRecursively(state: false);
			return;
		}
		AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
		Time.timeScale = 1f;
		Time.fixedDeltaTime = 0.033f;
		UnityEngine.SceneManagement.SceneManager.LoadScene(scene);
	}

	public void Main()
	{
	}
}
